package troopmanager.mooresr.us;



public class Vehicle implements Comparable<Vehicle> {
	private Integer vehicleId;
	private String make;
	private String model;
	private Integer year;
	private Integer seatbelts;
	private Integer liabilityPerPerson;
	private Integer liabilityPerAccident;
	private Integer propertyDamage;
	private String insuranceCarrier;
	private String policyNumber;
	private String licensePlate;
	private Integer ownerId;
	private String ownerFirstName;
	private String ownerLastName;
	
	public Vehicle() {
		
	}
	
	public Vehicle(Integer vehicleId, String make, String model, Integer year,
			Integer seatbelts, Integer liabilityPerPerson,
			Integer liabilityPerAccident, Integer propertyDamage,
			String licensePlate,
			Integer ownerId, String ownerFirstName, String ownerLastName) {
		super();
		this.vehicleId = vehicleId;
		this.make = make;
		this.model = model;
		this.year = year;
		this.seatbelts = seatbelts;
		this.liabilityPerPerson = liabilityPerPerson;
		this.liabilityPerAccident = liabilityPerAccident;
		this.propertyDamage = propertyDamage;
		this.licensePlate = licensePlate;
		this.ownerId = ownerId;
		this.ownerFirstName = ownerFirstName;
		this.ownerLastName = ownerLastName;
	}


	
	public Integer getVehicleId() {
		return vehicleId;
	}
	public void setVehicleId(Integer vehicleId) {
		this.vehicleId = vehicleId;
	}
	public String getMake() {
		return make;
	}
	public void setMake(String make) {
		this.make = make;
	}
	public String getModel() {
		return model;
	}
	public void setModel(String model) {
		this.model = model;
	}
	public Integer getYear() {
		return year;
	}
	public void setYear(Integer year) {
		this.year = year;
	}
	public Integer getSeatbelts() {
		return seatbelts;
	}
	public void setSeatbelts(Integer seatbelts) {
		this.seatbelts = seatbelts;
	}
	public Integer getLiabilityPerPerson() {
		return liabilityPerPerson;
	}
	public void setLiabilityPerPerson(Integer liabilityPerPerson) {
		this.liabilityPerPerson = liabilityPerPerson;
	}
	public Integer getLiabilityPerAccident() {
		return liabilityPerAccident;
	}
	public void setLiabilityPerAccident(Integer liabilityPerAccident) {
		this.liabilityPerAccident = liabilityPerAccident;
	}
	public Integer getPropertyDamage() {
		return propertyDamage;
	}
	public void setPropertyDamage(Integer propertyDamage) {
		this.propertyDamage = propertyDamage;
	}
	public String getInsuranceCarrier() {
		return insuranceCarrier;
	}
	public void setInsuranceCarrier(String insuranceCarrier) {
		this.insuranceCarrier = insuranceCarrier;
	}
	public String getPolicyNumber() {
		return policyNumber;
	}
	public void setPolicyNumber(String policyNumber) {
		this.policyNumber = policyNumber;
	}
	public String getLicensePlate() {
		return licensePlate;
	}
	public void setLicensePlate(String licensePlate) {
		this.licensePlate = licensePlate;
	}

	public Integer getOwnerId() {
		return ownerId;
	}

	public void setOwnerId(Integer ownerId) {
		this.ownerId = ownerId;
	}

	public String getOwnerFirstName() {
		return ownerFirstName;
	}

	public void setOwnerFirstName(String ownerFirstName) {
		this.ownerFirstName = ownerFirstName;
	}

	public String getOwnerLastName() {
		return ownerLastName;
	}

	public void setOwnerLastName(String ovnerLastName) {
		this.ownerLastName = ovnerLastName;
	}

	public String toString() {
		return this.make + " " + this.model + " owned by " + this.ownerFirstName + " " + this.ownerLastName ;
	}
	
	private String getSortKey() {
		return this.ownerLastName+this.ownerFirstName+this.vehicleId.toString();
	}

	@Override
	public int compareTo(Vehicle v) {
		// Vehicles are sorted by their owners
		// But, in order to differentiate between two vehicles owned by the same person, we append the vehicle #
		
		String thisSortKey = this.getSortKey();
		String otherSortKey = v.getSortKey();
		
		return thisSortKey.compareTo(otherSortKey);
	}
	

}
